---
import { getEntry, render } from "astro:content";
import Markdown from "@components/misc/Markdown.astro";
import FriendLinks from "@components/widget/FriendLinks.astro";
import I18nKey from "@i18n/i18nKey";
import { i18n } from "@i18n/translation";
import MainGridLayout from "@layouts/MainGridLayout.astro";
import { friendLinkSections } from "@/data/friend-links";

const linksPost = await getEntry("spec", "links");

if (!linksPost) {
	throw new Error("Links content not found");
}

const { Content } = await render(linksPost);
---

<MainGridLayout title={i18n(I18nKey.links)} description={i18n(I18nKey.links)}>
	<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32">
		<div class="card-base z-10 px-9 py-6 relative w-full">
			<Markdown class="mt-2">
				<h1> 友情链接 🔗 </h1>
				<p>欢迎来到友链页面！这里收集了一些优秀的技术博客和实用网站，希望对大家有所帮助。</p>
				<hr/>
				<FriendLinks sections={friendLinkSections} />
				<hr/>
				<Content />
			</Markdown>
		</div>
	</div>
</MainGridLayout>